
def run(params:list[str]):
    from ApiTools import apiTools,apiBase
    from ApiModels import apiModels
    collects=apiBase.argv_array(params,1,'proc/extract/tablename;',';')
    sys_prompt=apiBase.argv_json(params,2,'Extract table names from SQL')
    usr_prompt=apiBase.argv(params,3,'SELECT ta.au_id FROM titleauthor')
    type = apiBase.argv(params,4,"qa")
    # 获取vctid，ent_vector表id的信息,参数定义在ent_vector记录里面
    ids=apiBase.argv_array(params,5)

    try:
        vectdb = apiTools.load_vec()
        vcts=apiModels.get_vects(collects,ids)
            
        if type == "doc":
            ret = vectdb.askDirs(collects,None,usr_prompt)
        else:        
            ret=vectdb.askQA(vcts,sys_prompt,usr_prompt)
        #print(ret)
        return ret
    except Exception as e:
        return f"llm调用错误:{e}"
